﻿using F2B.Orchard.Schedule.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace F2B.Orchard.Schedule.Providers
{
    public static class SchedulePartExtensions
    {
        public static int DaysIncluded(this SchedulePart part)
        {
            if (part.AllDay)
            {
                return part.Duration.Days;
            }
            else
            {
                var end = part.StartDate + part.StartTime + part.Duration;
                if (end.Date == part.StartDate) return 1;
                else return (end.Date - part.StartDate).Days;
            }
        }
    }
}